package com.music.service.albums.constants;

public class AlbumSQLQueries {
	public final static String ADD_NEW_ALBUM =
		"insert into albums(created_member_id,album_name,state,creation_date,last_update_date)" +
		"values (?,?,?,sysdate,sysdate)";
	
	public final static String DELETE_ALBUM =
		"update albums set state = ? where album_id = ? && created_member_id = ? && state != ?";
	
	public final static String EDIT_ALBUM_NAME =
		"udpate albums set album_name=? where album_id=? && created_member_id=? && state = ?";
	
	public final static String ADD_EXISTING_ALBUM_TO_DEFAULT_FOLDER =
		"insert into member_albums_r(member_id,album_id,creation_date,last_update_date) " +
		"values(?,?,sydate,sysdate)";
	
	public final static String ADD_SONG_TO_ALBUM = 
		"insert into album_songs_r (album_id,song_id,created_member_id,creation_date,last_update_date)" +
		"values(?,?,?,sysdate,sysdate)";
	
	public final static String DELETE_SONG_FROM_ALBUM =
		"delete from album_songs_r where album_id = ? && song_id = ? && created_member_id = ?";
	
	/**
	 * Check to see whether member has permission to add or delete song in album.
	 */
	public final static String CHECK_ALBUM_PERMISSION = 
		"select count(*) as count from albums where album_id=? && created_member_id=? && state=?";
	
	public final static String VIEW_DEFAULT_ALBUMS =
		"select a.album_id,a.album_name,a.state,a.creation_date,a.last_update_date,a.created_member_id" +
		" from albums a,member_albums_r b where a.album_id = b.album_id && b.member_id = ?" +
		" && a.state != ?";
	
	public final static String VIEW_RECENT_ALBUMS =
		"select album_id,album_name,state,creation_date,last_update_date,created_member_id" +
		" from albums a,member_albums_r b where a.album_id = b.album_id && b.member_id = ?" +
		" && a.state != ? order by a.last_update_date";
	
}
